package com.fg.cloud.manager.service.order.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fg.cloud.manager.entry.BaseEntity;
import com.fg.cloud.manager.entry.order.OrderDetailEntity;
import com.fg.cloud.manager.mapper.BaseMapper;
import com.fg.cloud.manager.mapper.order.OrderDetailMapper;
import com.fg.cloud.manager.service.BaseServiceImpl;
import com.fg.cloud.manager.service.order.OrderDetailService;

/**
 * @author ：
 * @date ： 2017年6月21日 下午5:34:10
 * @Desc ：订单明细实现service
 */
@Service
public class OrderDetailServiceImpl extends BaseServiceImpl implements OrderDetailService {

	@Autowired
	private OrderDetailMapper orderDetailMapper;

	@Override
	protected <T extends BaseEntity> BaseMapper getBaseMapper() {
		return orderDetailMapper;
	}

	// 根据订单id，删除订单明细
	@Override
	public int delByOrderId(long orderId) {
		int temp = orderDetailMapper.delByOrderId(orderId);
		return temp;
	}
	
	/**
	 * 根据订单ID查询订单商品
	 */
	@Override
	public List<OrderDetailEntity> selectByOrderId(Long orderId,String order,String sort) {
		return orderDetailMapper.selectByOrderId(orderId,order,sort);
	}

	@Override
	public boolean delByFacId(Long facId) {		
		return orderDetailMapper.delByFacId(facId) > 0 ? true : false;
	}

}
